Ubuntu 15.04
Sponsored Link

Squid + SquidClamav
2015/05/20
 
Install SquidClamav and Configure Proxy Server to scan downloaded files to protect from virus.
[1]
[2] Install Clamd.
root@prox:~#
apt-get -y install clamav-daemon
[3] Install SquidClamav ( Download latest version of it from the following link ).
http://sourceforge.net/projects/squidclamav/files/squidclamav/
# install required packages

root@prox:~#
apt-get -y install gcc make curl libcurl4-gnutls-dev c-icap libicapapi-dev
root@prox:~#
wget http://downloads.sourceforge.net/project/squidclamav/squidclamav/6.12/squidclamav-6.12.tar.gz

root@prox:~#
tar zxvf squidclamav-6.12.tar.gz

root@prox:~#
cd squidclamav-6.12

root@prox:~/squidclamav-6.12#
./configure --with-c-icap

root@prox:~/squidclamav-6.12#
root@prox:~/squidclamav-6.12#
make install

root@prox:~/squidclamav-6.12#
root@prox:~#
ln -s /etc/c-icap/squidclamav.conf /etc/squidclamav.conf

root@prox:~#
vi /etc/squidclamav.conf
# line 18: change (destination URL for redirect. Create it first)

redirect
http://www.srv.world/error.html
[4] Configure c-icap and Squid.
root@prox:~#
vi /etc/default/c-icap
# line 6: change

START=
yes
root@prox:~#
vi /etc/c-icap/c-icap.conf
# line 142: change to the admin email

ServerAdmin
root@srv.world
# line 151: change to the hostname

ServerName
prox.srv.world
# line 502: add

Service squidclamav squidclamav.so
root@prox:~#
systemctl restart c-icap
root@prox:~#
vi /etc/squid3/squid.conf
# line 6077: add

icap_enable on
# line 6198: add

adaptation_send_client_ip on
# line 6208: add

adaptation_send_username on
# line 6213: add

icap_client_username_header X-Authenticated-User
# line 6309: add follows

icap_service service_req reqmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav
adaptation_access service_req allow all
icap_service service_resp respmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav
adaptation_access service_resp allow all
root@prox:~#
systemctl restart squid3
[5] Try to access to the page that has trial virus below.
http://downloadcenter.trendmicro.com/index.php?regs=jp&prodid=1424
Click 'eicar.com' and try to download it. Then, Virus will be detected and accessing is redirected to the page you set.
 
Tweet